// Loggr::Tools::Strings
// Tools make Loggr be more autonomous.
// By George Ulyanov (c) 2010

#include "Config.h"

#ifndef LOGGR_TOOLS_STRINGS_H_
#   include "Strings.h"
#endif

#if defined (LOGGR_WIN32API)
#	include <Windows.h>
#elif defined (LOGGR_OTHER)
#	include <stdlib.h>
#endif

namespace Loggr
{
    namespace Tools
    {
        void MB2W(const std::string& mbStr, std::wstring& wStr)
        {
            wStr.resize(mbStr.size());
#if defined (LOGGR_WIN32API)
            ::MultiByteToWideChar(CP_WINANSI, 0, mbStr.c_str(), mbStr.length(), &wStr[0], mbStr.length());
#elif defined (LOGGR_OTHER)
#   pragma error "Not implemented"
#endif
        }

        void W2MB(const std::wstring& wStr, std::string& mbStr)
        {
            mbStr.resize(wStr.size());
#if defined (LOGGR_WIN32API)
			::WideCharToMultiByte(CP_WINUNICODE, 0, wStr.c_str(), wStr.length(), &mbStr[0], wStr.length(), "?", 0);
#elif defined (LOGGR_OTHER)
#   pragma error "Not implemented"
#endif
        }

    }
    // namespace Tools
}
// namespace Loggr
